<template>
  <div>
    <div class="main-page">
      <div class="logo-div">
        <img class="logo-img" src="@/static/logo.png" alt="">
      </div>
      <div class="main-title subheading-heavy">欢迎使用订单管理系统</div>
      <div class="button-all-div">
        <div class="button-all"
             :class="active === GLOBAL.roleType.admin ? 'button-all-active' : ''"
             @click="roleLogin(GLOBAL.roleType.admin)">
          <img class="icon-24" src="@/static/icon/24px_admin.png" alt=""/>
          <span class="body-heavy">管理员登录</span>
        </div>
        <div class="button-all"
             :class="active === GLOBAL.roleType.sales ? 'button-all-active' : ''"
             @click="roleLogin(GLOBAL.roleType.sales)">
          <img class="icon-24" src="@/static/icon/24px_sales.png" alt=""/>
          <span class="body-heavy">销售员登录</span>
        </div>
      </div>
    </div>
  </div>
</template>

<script>
export default {
  components: {
  },
  name: "LoginViewRole",
  data() {
    return {
      active: this.GLOBAL.roleType.admin,
    };
  },
  mounted() {
    if (localStorage.getItem("token")) {
      this.$router.push(this.GLOBAL.pathSetting.todo.main)
    }
  },
  methods: {
    roleLogin(roleType) {
      this.active = roleType
      this.$router.push(this.GLOBAL.pathSetting.login.role + roleType)
    },
  },
};
</script>
<style scoped>
.logo-div {
  display: flex;
  align-items: center;
  justify-content: center;
  margin-top: 230px;
}
.logo-img {
  height: 40px;
  width: 96px;
}
.main-title {
  text-align: center;
}
.button-all-div {
  height: 120px;
  margin: 72px 24px 0 24px;
}
.button-all {
  display: flex;
  flex-direction: row;
  justify-content: center;
  align-items: center;

  height: 48px;
  margin: 24px 0;

  border: 1px solid #FCD538;
  box-sizing: border-box;
  border-radius: 24px;
}
.button-all-active {
  background: #FCD538;
  box-shadow: 0 4px 24px rgba(251, 202, 4, 0.32);
}
.button-all > span {
  padding-left: 10px;
}
</style>
<style>
</style>